<!DOCTYPE html>
<html>
<head>
  <script src="https://cdn.jsdelivr.net/npm/sockjs-client@1.5.0/dist/sockjs.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/stompjs@2.3.3/lib/stomp.min.js"></script>
</head>
<body>
<script>
  const socket = new SockJS('http://localhost:8081/websocket');
  const stomp = Stomp.over(socket);

  stomp.connect({}, function() {
    alert("连接成功!");
    stomp.disconnect();
  }, function(error) {
    alert("连接失败: " + error);
  });
</script>
</body>
</html>